<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.google.appengine.api.users.User"%>
<%@ page import="com.google.appengine.api.users.UserService"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>
<%@ page import="javax.jdo.PersistenceManager"%>
<%@ page import="howl.model.*" %>
<%@ page import="java.util.List"%>
<%@ page import="howl.types.HowlUser"%>
<%@ page import="javax.jdo.Query"%>
<%
	UserService userService = UserServiceFactory.getUserService();
	User user = userService.getCurrentUser();

	HowlUser hu = Model.getHowlUserfromUser(user);
	
	System.out.println(hu);
	if (hu != null) {
		response.sendRedirect("/Auth/index.jsp");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Howl: a web service for the Internet of Things</title> 
<link rel="stylesheet" type="text/css" href="/style.css" />

<script>
function showT(c,f){
	if(c.checked){
		f.PachubeKey.style.visibility="visible"
		document.getElementById('hidecell').style.display = 'inline';
		document.getElementById('hidecell').style.visibility = 'visible';
		 
	} else {
		f.PachubeKey.style.visibility="hidden"
		document.getElementById('hidecell').style.display = 'none';
		document.getElementById('hidecell').style.visibility = 'hidden';
	}
}

function showYFD(c,f){
	if(c.checked){
		f.YourFlowingData.style.visibility="visible"
		document.getElementById('YFDrow').style.display = '';
		document.getElementById('YFDrow').style.visibility = 'visible';

		 
	} else {
			f.YourFlowingData.style.visibility="hidden"
		document.getElementById('YFDrow').style.display = 'none';
		document.getElementById('YFDrow').style.visibility = 'hidden';
		
	}
}

function displayRow(){
	var row = document.getElementById("YFDrow");
	if (row.style.display == '')  row.style.display = 'none';
	else row.style.display = '';
}

</script>
</head>
<body>
<div id="page">
  <div id="TopBanner"> 
	<p>Howl: a web service for the Internet of Things</p>
  </div> <! -- end TopBanner --> 
  <div id="content">
  <h3>Select which services you want to use:</h3>
<table>
	<form action="/Signup" method="post">
	
	<tr>
		<td align="right"><input type="checkbox" name="Email"
			value="Email" checked="yes"></input></td>
		<td>Email</td>
		<td></td>
	</tr>
	<tr>
		<td align="right"><input type="checkbox" name="Rss" value="Rss"
			checked="yes"></input></td>
		<td>Rss</td>
		<td></td>
	</tr>
	<tr>
		<td align="right"><input type="checkbox" name="Layar"
			value="Layar"></input></td>
		<td>Layar</td>
		<td></td>
	</tr>

	<tr>
		<td align="right"><input type="checkbox" name="Pachube"
			value="Pachube" onclick="showT(this,this.form)"></input></td>
		<td>Pachube</td>
		<td id="hidercell">
		
		<input name="PachubeKey" size="35" value="API KEY" type="text"
			style="visibility: hidden"></td>
	
	</tr>
		<tr>
		<td align="right"><input type="checkbox" name="Twitter"
			value="Twitter" onclick="showYFD(this,this.form)"></input></td>
		<td>Twitter</td>
		<td></td>
	</tr>
	<tr >
		<td align="right" ><input type="checkbox" name="YourFlowingData"
			value="YourFlowingData" onclick="showTYFD(this,this.form)" style="visibility: hidden" ></input></td>
		<td id="YFDrow" style="visibility: hidden" >Your Flowing Data</td>
		<td></td>
	</tr>
	

	<tr>
	
		<td align="center" colspan="2"><input type="submit"
			name="Continue" value="Continue"></input></td>
	</tr>
	</form>
</table>
</div> <! -- end content -->
</div> <! -- end page -->
<div id="footer">
	<p>Copyright University of Wolverhampton &copy; 2009</p>
</div>
</body>
</html>